import 'package:flutter/material.dart';

import '../index/index_navigator.dart';

class IndexPage extends StatefulWidget {
  const IndexPage({super.key});

  @override
  State<IndexPage> createState() => _IndexPageState();
}

class _IndexPageState extends State<IndexPage> {
  final Color _color = const Color.fromRGBO(200, 200, 200, 0.5);
  final Color _colorWhite = Colors.white;

  final BoxDecoration boxDecoration = BoxDecoration(
    borderRadius: BorderRadius.circular(10),
    color: Color.fromRGBO(200, 200, 200, 0.5),
  );

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('首页'),
        centerTitle: true,
      ),
      body: Container(
          decoration: BoxDecoration(
              gradient: LinearGradient(
                  begin: Alignment.topCenter,
                  end: Alignment.bottomCenter,
                  colors: [
                Color.fromRGBO(200, 100, 100, 0.5),
                Color.fromRGBO(0, 0, 200, 0.5),
              ])),
          child: ListView(children: [
            IndexNavigator(),
            Container(
              padding: EdgeInsets.all(10),
              margin: EdgeInsets.only(left: 10, right: 10),
              decoration: boxDecoration,
              child: Wrap(spacing: 10, alignment: WrapAlignment.spaceBetween, children: [
                Container(
                    margin: EdgeInsets.all(10),
                    child: GestureDetector(
                        child: Column(
                            crossAxisAlignment: CrossAxisAlignment.center,
                            mainAxisAlignment: MainAxisAlignment.spaceAround,
                            children: [
                              Image.asset('images/dingdan.png',
                                  color: Colors.black45, width: 40),
                              Text(
                                '订单',
                                style: TextStyle(color: Colors.black),
                              ),
                            ]),
                        onTap: () {
                          Navigator.of(context).pushNamed('/order');
                        })),
                Container(
                  margin: EdgeInsets.all(10),
                  child: GestureDetector(
                    child: Column(
                        crossAxisAlignment: CrossAxisAlignment.center,
                        mainAxisAlignment: MainAxisAlignment.spaceAround,
                        children: [
                          Image.asset('images/xiangmu.png',
                              color: Colors.black45, width: 40),
                          Text(
                            '项目',
                            style: TextStyle(color: Colors.black),
                          )
                        ]),
                    onTap: () {
                      Navigator.of(context).pushNamed('/project');
                    },
                  ),
                ),
                Container(
                  margin: EdgeInsets.all(10),
                  child: Column(
                      crossAxisAlignment: CrossAxisAlignment.center,
                      mainAxisAlignment: MainAxisAlignment.spaceAround,
                      children: [
                        Image.asset('images/shangpin.png',
                            color: Colors.black45, width: 40),
                        GestureDetector(
                            child: Text(
                              '商品',
                              style: TextStyle(color: Colors.black),
                            ),
                            onTap: () {
                              Navigator.of(context).pushNamed('/order');
                            })
                      ]),
                ),
                Container(
                  margin: EdgeInsets.all(10),
                  child: Column(
                      crossAxisAlignment: CrossAxisAlignment.center,
                      mainAxisAlignment: MainAxisAlignment.spaceAround,
                      children: [
                        Image.asset('images/hulishi.png',
                            color: Colors.black45, width: 40),
                        GestureDetector(
                            child: Text(
                              '员工',
                              style: TextStyle(color: Colors.black),
                            ),
                            onTap: () {
                              Navigator.of(context).pushNamed('/order');
                            })
                      ]),
                ),
                Container(
                    margin: EdgeInsets.all(10),
                    child: GestureDetector(
                        child: Column(
                            crossAxisAlignment: CrossAxisAlignment.center,
                            mainAxisAlignment: MainAxisAlignment.spaceAround,
                            children: [
                              Image.asset('images/库存.png',
                                  color: Colors.black45, width: 40),
                              Text(
                                '库存',
                                style: TextStyle(color: Colors.black),
                              ),
                            ]),
                        onTap: () {
                          Navigator.of(context).pushNamed('/order');
                        })),
                Container(
                  margin: EdgeInsets.all(10),
                  child: GestureDetector(
                    child: Column(
                        crossAxisAlignment: CrossAxisAlignment.center,
                        mainAxisAlignment: MainAxisAlignment.spaceAround,
                        children: [
                          Image.asset('images/顾客.png',
                              color: Colors.black45, width: 40),
                          Text(
                            '顾客',
                            style: TextStyle(color: Colors.black),
                          )
                        ]),
                    onTap: () {
                      Navigator.of(context).pushNamed('/project');
                    },
                  ),
                ),
                Container(
                  margin: EdgeInsets.all(10),
                  child: Column(
                      crossAxisAlignment: CrossAxisAlignment.center,
                      mainAxisAlignment: MainAxisAlignment.spaceAround,
                      children: [
                        Image.asset('images/营销.png',
                            color: Colors.black45, width: 40),
                        GestureDetector(
                            child: Text(
                              '营销',
                              style: TextStyle(color: Colors.black),
                            ),
                            onTap: () {
                              Navigator.of(context).pushNamed('/order');
                            })
                      ]),
                ),
                Container(
                  margin: EdgeInsets.all(10),
                  child: GestureDetector(
                    child: Column(
                        crossAxisAlignment: CrossAxisAlignment.center,
                        mainAxisAlignment: MainAxisAlignment.spaceAround,
                        children: [
                          Image.asset('images/book.png',
                              color: Colors.black45, width: 40),
                          Text(
                            '预约',
                            style: TextStyle(color: Colors.black),
                          )
                        ]),
                    onTap: () {
                      Navigator.of(context).pushNamed('add');
                    },
                  ),
                ),
                Container(
                    margin: EdgeInsets.all(10),
                    child: GestureDetector(
                        child: Column(
                            crossAxisAlignment: CrossAxisAlignment.center,
                            mainAxisAlignment: MainAxisAlignment.spaceAround,
                            children: [
                              Image.asset('images/排班.png',
                                  color: Colors.black45, width: 40),
                              Text(
                                '排班',
                                style: TextStyle(color: Colors.black),
                              ),
                            ]),
                        onTap: () {
                          Navigator.of(context).pushNamed('/order');
                        })),
                Container(
                  margin: EdgeInsets.all(10),
                  child: GestureDetector(
                    child: Column(
                        crossAxisAlignment: CrossAxisAlignment.center,
                        mainAxisAlignment: MainAxisAlignment.spaceAround,
                        children: [
                          Image.asset('images/邀约.png',
                              color: Colors.black45, width: 40),
                          Text(
                            '邀约',
                            style: TextStyle(color: Colors.black),
                          )
                        ]),
                    onTap: () {
                      Navigator.of(context).pushNamed('/project');
                    },
                  ),
                ),
                Container(
                  margin: EdgeInsets.all(10),
                  child: GestureDetector(
                    child: Column(
                        crossAxisAlignment: CrossAxisAlignment.center,
                        mainAxisAlignment: MainAxisAlignment.spaceAround,
                        children: [
                          Image.asset('images/分析.png',
                              color: Colors.black45, width: 40),
                          Text(
                            '分析',
                            style: TextStyle(color: Colors.black),
                          )
                        ]),
                    onTap: () {
                      Navigator.of(context).pushNamed('add');
                    },
                  ),
                ),
              ]),
            ),
          ])),
    );
  }
}
